import React, { Component } from 'react';
import{Link,Route,Switch,Redirect} from 'react-router-dom'
import { twoLevel } from '../../router/index'
import './首页.css'
class shouye1 extends Component {
  constructor(props) {
    super(props);
    this.state = {  }
  }
  render() { 
    return ( 
    <div>
      <div>当前页面------首页 路由懒加载</div>
      <div>
        <ul className="lateralNavigation clearfix">
          <li>
            <Link to="/首页/daohang1">导航页1</Link>
          </li>
          <li>
            <Link to="/首页/daohang2">导航页2</Link>
          </li>
          <li>
            <Link to="/首页/daohang3">导航页3</Link>
          </li>
        </ul>
      </div>
      <div>
        <Switch>
          {
            twoLevel.map((item,index)=>{
              if(item.exact){
                return <Route key={index} path={`${item.path}${item.parem?item.parem:''}`} component={item.component} exact></Route>
              }else{
                return <Route key={index} path={`${item.path}${item.parem?item.parem:''}`} component={item.component}></Route>
              }
            })
          }
          <Redirect to="/首页/daohang1"  from="/首页"></Redirect>
        </Switch>
      </div>
    </div> 
    );
  }
}
 
export default shouye1;